﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using A2DFramework.UdpLogServerConsole.Config;
using A2DFramework.LogService;
using A2DFramework.XmlService;

namespace A2DFramework.UdpLogServerConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            UdpClient udpServer = new UdpClient(Configuration.Port);
            IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, Configuration.Port);
            while (true)
            {
                Byte[] receiveBytes = udpServer.Receive(ref endPoint);
                string returnData = Encoding.GetEncoding("GB2312").GetString(receiveBytes);
                ExceptionWrapper wrapper = SerializeUtils.DeserializeFromXML<ExceptionWrapper>(returnData);

                Console.WriteLine(wrapper.Ip);
                Console.WriteLine("---->"+wrapper.GetHashCode());
            }
        }
    }
}
